﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UniSender.Test
{
    class RequestStub : UniSenderRequest
    {
        public Func<string> StubGetUrl;
        public Func<string> StubGetQuery;
        public Func<bool, string> StubSend;

        public RequestStub(string host, string lang, string method, string key, IDictionary<string, object> args)
            : base(host, lang, method, key, args)
        { }

        public RequestStub()
            : this(UniSenderRequest.HOST, "tt", "action", "test", null)
        { }

        protected override string GetUrl()
        {
            return StubGetUrl != null ? StubGetUrl() : base.GetUrl();
        }

        public override string GetQuery()
        {
            return StubGetQuery != null ? StubGetQuery() : base.GetQuery();
        }

        public override string Send(bool useGet)
        {
            return StubSend != null ? StubSend(useGet) : "{}";
        }
    }
}
